lst = []

def input_name(name):
    lst.append(name)

while True:
    name = input("输入一个名字:")
    if  name == '':
        lst.sort(reverse=True)
        print(lst)
        exit()
    else:
        if name in lst:
            print(f"{name}姓名已经存在")
        else:
            input_name(name)
